package fractales.algo;

import java.awt.Graphics2D;
import java.awt.geom.Point2D;

import fractales.ui.FractaleUI;


public class CourbeDuDragon extends Fractale
{
	private static final double _45_DEGRES = Math.PI / 4;
	private static final double _135_DEGRES = Math.PI / 4 * 3;
	
	protected void recurse(Graphics2D g, double x1, double y1, double x2, double y2, double length, double angle, int iteration)
	{
		double newLength = Math.sqrt((length * length) / 2.0);
		
		Point2D p1 = drawLine(g, x1, y1, newLength, angle - _45_DEGRES,
				iteration);
		drawLine(g, x2, y2, p1.getX(), p1.getY(), newLength, angle
				- _135_DEGRES, iteration);
	}
	
	public static void main(String[] args)
	{
		CourbeDuDragon p = new CourbeDuDragon();
		FractaleUI.display(p);
	}
}
